<?php
/**
*  +----------------------------------------------------------------------------------------------+
*   | Author: ONLY <491518132@qq.com>
*	+----------------------------------------------------------------------------------------------+
*   | Creater Time : 2013-10-15 	
*  +----------------------------------------------------------------------------------------------+
*    Link :		http://www.phpyrb.com
*					http://www.cloudsskill.com 
*					http://www.goshopx.com  
*					http://www.shopingj.com 	     
*  +----------------------------------------------------------------------------------------------+
**/

	class IntergralAction extends BaseAction{
		function _initialize(){
			parent::_initialize();
			$this->dao=M("check_product");
		}

		function index() {			
			$sql = 'select a1.id,a1.sn,a3.name,a4.point,a1.count_num,a1.amount,(a4.point * a1.count_num) all_num from `order` a1,order_goods a2,product a3,check_product a4 where a1.id = a2.order_id and a2.product_id = a3.id and a3.id = a4.product_id and a1.status=10 and a1.userid = '.$_SESSION['userid'].' and a1.sn not in (select content from bakcv where user_id = '.$_SESSION['userid'].')';
			$attr = M ()->query ( $sql );
			
			$count = count($attr);//dump($count);die();
			$this->assign("totalCount",$count);
			if($count>0){
				$page=new Page($count,$this->listrows);
				$sql .= " limit $page->firstRow,$page->listRows ";
				$list = M()->query($sql);
				$this->assign("lista",$list);
			}
			
			//dump($_SESSION); die(); 
			$this->display();
		}

		function edit(){
			$id = $_REQUEST['id'];
			$attr=self::chepro($id);
			$this->assign("lista",$attr);
			$this->assign("module_name","Checkpro");
			$this->display();
		}
		function add(){
			parent::addbackcv($_SESSION['userid'],$_REQUEST['sn'],$_REQUEST['all_num'],0);
			$this->display();
		}
		/**
		 * 初始化模块信息
		 */
		function _setmod($model_name, $model_id) {
			$this->model_name = $model_name;
			$this->model_id = $model_id;
		}
		

		
	} 




